package com.study.socket.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author yuhuan
 * @date 2023/11/21
 */
@Controller
@RequestMapping("/socket")
public class WebController {

    /**
     * 跳转到websocket.html页面，携带自定义的cid信息。
     */
    @GetMapping("/index/{cid}")
    public String toWebSocketHtml(@PathVariable String cid, Model model) {
        model.addAttribute("cid", cid);
        return "websocket";
    }
}
